package com.slz3.business.module.orderManagement.ordRefund.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.orderManagement.ordRefund.domain.OrdRefund;
import com.slz3.business.module.orderManagement.ordRefund.domain.OrdRefundFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class OrdRefundTransactionalServiceImpl implements OrdRefundTransactionalService {

    @Override
    public OrdRefund modify(OrdRefund ordRefundNew) {
        Repositorys.ordRefund.test();
        Repositorys.ordRefund.save(OrdRefundFactory.initBaseFields());
        System.err.println(1/0);
        ordRefundNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.ordRefund.saveAndFlush(ordRefundNew);
    }

    @Override
    public List<OrdRefund> batchModify(List<OrdRefund> ordRefundList) {
        return Repositorys.ordRefund.saveAll(ordRefundList);
    }
}
